<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['数据统计','重量误差率统计']" icon="fa fa-area-chart" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<div class="data_map_box">
		<div class="data_map">
			<div class="map_header">
				<h3 class="title">重量误差统计图</h3>
				<div class="btn_ground">
					<button class="btn_color" [ngClass]="{'active':curBtn === '1'}" (click)="dateSelect('1')">今天</button>
					<button class="btn_color" [ngClass]="{'active':curBtn === '2'}" (click)="dateSelect('2')">昨天</button>
					<button class="btn_color" [ngClass]="{'active':curBtn === '3'}" (click)="dateSelect('3')">前天</button>
					<button class="btn_color" [ngClass]="{'active':curBtn === '4'}" (click)="dateSelect('4')">近三天</button>
					<button class="btn_color" [ngClass]="{'active':curBtn === '5'}" (click)="dateSelect('5')">近十天</button>
					<button class="btn_color" [ngClass]="{'active':curBtn === '6'}" (click)="dateSelect('6')">近一个月</button>
				</div>
			</div>
			<div class="row">
				<div id="weight_map" class="col-md-7 col-sm-7"></div>
				<div class="col-md-5 map_info col-sm-5">
					<h3 class="title" style="font-weight: normal;margin-bottom: 16px;">统计图信息</h3>
					<div class="line">
						<span class="text">车辆：</span>
						<span>{{mapModel.carNumber}}</span>
					</div>
					<div class="line">
						<span class="text">总趟数：</span>
						<span style="color: #1A6DDD;font-size: 22px;">{{mapModel.total}}</span>
					</div>        
					<div class="line">
						<span class="text">合格趟数：</span>
						<span class="green" style="font-size: 22px;">{{mapModel.pass}}</span>
					</div>
					<div class="line">
						<span class="text">不合格趟数：</span>
						<span class="red" style="font-size: 22px;">{{mapModel.unpass}}</span>
					</div>
				</div>
			</div>
			
		</div>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>重量误差率统计</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<sa-company-tree-car companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree-car>		
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">车辆用途</span>
									<select name="" class="top_module_select" id="useTypeL1" [(ngModel)]="useTypeL1" (change)='carUseTypeL1Change()' style="min-width: 120px;">
										<option value="">全部</option>
										<option value="" *ngFor="let item of carTypeList" [value]="item.id">{{item.label}}</option>
									</select>
								</div>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">车辆分类</span>
									<select name="" class="top_module_select" id="useTypeL2" [(ngModel)]="useTypeL2" style="min-width: 120px;">
										<option value="">全部</option>
										<option value="" *ngFor="let item of carTypeDetailList" [value]="item.id">{{item.label}}</option>
									</select>
								</div>
								<div class="selectDate top_module">
									<div class="input-daterange input-group s_selected_time_box s_hover_box">
										<input type="text" [(ngModel)]='startTime' class="form-control s_selected_time" id="datetimepicker1"  autocomplete="off" placeholder="选择开始时间"/>
										<span class="s_selected_time_spe">至</span>
										<input type="text" [(ngModel)]='endTime' class="form-control s_selected_time" id="datetimepicker2"  autocomplete="off" placeholder="选择结束时间"/>
										<div class="s_del_icon" (click)='del_date()'>x</div>
									</div>
								</div>
								<button type="button" class="btn btn-primary" (click)="search_data()">查询</button>
								<button type="button" class="btn btn-primary" (click)="export_totle(dataExportModal)">导出</button>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>设备ID</th>
										<th>车牌号码</th>
										<th>所属公司</th>
										<th>车辆用途</th>
										<th>车辆分类</th>
										<th>重量(吨)</th>
										<th>地磅重量(吨)</th>
										<th>重量差(吨)</th>
										<th>误差率(%)</th>
										<th>时间</th>
										<!--<th>操作</th>-->
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i" [ngClass]='{selected: activeSelected === row.id }' (click)="rowSelectEvent(row,i)">
										<td>{{row.deviceId}}</td>
										<td>{{row.carNumber}}</td>
										<td>{{row.companyName}}</td>
										<td>{{row.useTypeL1}}</td>
										<td>{{row.useTypeL2}}</td>
										<td>{{row.weight}}</td>
										<td>{{row.weighbridge}}</td>
										<td>{{row.deviation}}</td>
										<td>
											<span *ngIf="row.percent < 5" class="green">{{row.percent}}</span>
					            			<span *ngIf="row.percent >= 5" class="red">{{row.percent}}</span>
										</td>
										<td>{{row.weighbridgeDate}}</td>
										<!--<td>
											<button class="" (click)="enterMap(row)">查看统计图</button>
										</td>-->
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!-- 数据导出    弹窗-->
	<div bsModal #dataExportModal="bs-modal" id="dataExportModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg" >
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="cancelExport(dataExportModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">重量误差报表导出</h4>
				</div>
				<div class="modal-body" style="padding: 20px;">
					<div class="row form-horizontal">
						<div>
							<div class="form-group">
			                    <label class="control-label col-md-2 col-sm-2">分组方式</label>
			                    <div class="col-md-8 col-sm-8">
			                    	<div class="inline_block">
			                    		<label class="radio radio-inline">
					                        <input type="radio" class="radiobox" [(ngModel)]="dataGrounding" name="all" value="">
					                        <span>无</span>
					                    </label>
										<label class="radio radio-inline">
					                        <input type="radio" class="radiobox" [(ngModel)]="dataGrounding" name="car" value="car">
					                        <span>车辆</span>
					                    </label>
										<label class="radio radio-inline">
					                        <input type="radio" class="radiobox" [(ngModel)]="dataGrounding" name="everyday" value="day">
					                        <span>每天</span>
					                    </label>
									</div>
			                    </div>
		                  	</div>
		                  	<div class="form-group">
			                    <label class="control-label col-md-2 col-sm-2">排序方式</label>
			                    <div class="col-md-10 col-sm-10">
			                    	<div class="inline_block">
										<label class="radio radio-inline">
					                        <input type="radio" class="radiobox" [(ngModel)]="dataSort" name="errorRate" value="numberASC">
					                        <span>误差率升序</span>
					                    </label>
					                    <label class="radio radio-inline">
					                        <input type="radio" class="radiobox" [(ngModel)]="dataSort" name="errorRate" value="numberDESC">
					                        <span>误差率降序</span>
					                    </label>
										<label class="radio radio-inline">
					                        <input type="radio" class="radiobox" [(ngModel)]="dataSort" name="time" value="dateASC">
					                        <span>时间升序</span>
					                    </label>
					                    <label class="radio radio-inline">
					                        <input type="radio" class="radiobox" [(ngModel)]="dataSort" name="time" value="dateDESC">
					                        <span>时间降序</span>
					                    </label>
									</div>
			                    </div>
		                  	</div>
		                  	
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="cancelExport(dataExportModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="exportSubmit()">导出</button>
				</div>
			</div>
		</div>
	</div>
	<!--数据导出  end-->
</div>
